package com.mooke.dao.Impl;

import com.mooke.dao.UserloginDao;
import com.mooke.entity.Userlogin;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


@Repository
public class UserloginDaoImpl extends SqlSessionDaoSupport implements UserloginDao {


    @Autowired
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory)
    {
        super.setSqlSessionFactory(sqlSessionFactory);
    }

    @Override
    public boolean login(String id, Userlogin userEntity){
        if(	getSqlSession().selectOne(id, userEntity)!=null) return true;
        return false;
    };

    @Override
    public Userlogin queryrole(String id,Userlogin userEntity){

        return getSqlSession().selectOne(id, userEntity);
    };

    @Override
    public Userlogin foundPassword(String id,Userlogin userEntity){

        return getSqlSession().selectOne(id, userEntity);
    };

    @Override
    public boolean updateUserLoginAdmin(String id, Userlogin UserEntity){
        if(	getSqlSession().update(id, UserEntity)>0)return true;
        return false;
    };


}
